
var srchList_index;



$(function(){
	
	var date = new Date();
	var str = date.Format("yyyy-MM-dd");
	
	$("#start_date").val(str);
	$("#end_date").val(str);
});



function setControlValue(id,value){
	$("#"+id+"").val(value);
}

//查询记录
function doSrch(){
	
	$("#resultList").html("");
	if($.trim($("#start_date").val())=="" || $.trim($("#end_date").val())=="" ) {
		layer.msg("请输入查询起始和截止时间");
		return;
	}
	
	if(strToDate($.trim($("#start_date").val()))>strToDate($.trim($("#end_date").val()))){
		layer.msg("开始时间不能大于结束时间");
		return;
	}
	
	var rs = appControl.doSrch($("#start_date").val(),$("#end_date").val(),"-1");
	if(rs=="-1" || rs=="-100"){
		layer.msg("查询失败");
		return;
	}
	
	
}


function showSrchRs(rs){
	
	var jsonData = JSON.parse(rs);
	if(jsonData.is_success=="0"){
		layer.msg("查询失败");
	}else if(jsonData.is_success=="1"){
		//alert('查询成功');
		var flows = jsonData.flows;
		if(flows==undefined){
			layer.msg("查询无数据");
			return;
		}
		
		for(var i=0;i<flows.length;i++){
			var cardno = flows[i].CARDNO;
			var usercode = flows[i].USERCODE;
			var jytime = flows[i].JYSJ;
			var username = flows[i].USERNAME;
			var jyje = flows[i].JY_MONEY;
			var jzje = flows[i].JZ_MONEY;
			var flowcode=flows[i].FLOWCODE;
			var jztime = flows[i].JZSJ;
			var shtml = "<tr><td width=\"10%\">"+(i+1)+"</td><td width=\"15%\">"+usercode+"</td><td width=\"20%\">"+jytime+"</td><td width=\"15%\">"+jyje+"</td><td width=\"15%\">"+jzje+"</td><td>"+jztime+"</td></tr>";
			//var shtml = "<div> 卡号:"+cardno+"  交易时间:"+jytime+" 用户："+username+" 交易金额："+jyje+" 纠正后交易金额:"+jzje+" </div>"
			
			$("#resultList").append(shtml);
		}
		
		srchList_index = layer.open({
		  type: 1,
		  skin: 'layui-layer-rim', //加上边框
		  area: ['1030px', '540px'], //宽高
		  content:$("#srchResult"),
		  title:"纠错/回退记录"
		});
		
		
	}else{
		alert('网络连接不稳定,请重试');
	}
}

function goBack(){
	appControl.goHome();
}
